package com.linh.trade.data;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

public class RandomMarketData extends MarketData {

	
	@Override
	protected List<Point> sourceData() {
		BrownianMotion brownianMotion=new BrownianMotion();
		List<Point> points=new ArrayList<Point>();
		double baseRate=1.267690;
		for(int i=0;i<300000;i++){
			double prob=Math.random();
			int sign=0;
			if(prob<0.5){
				sign=1;
			}
			if(prob>0.5){
				sign=-1;
			}
			double move=brownianMotion.next()*sign;
			double scale=Math.exp(move);
			double rate=baseRate*scale;
			Point p=new Point(new Date(), rate, System.nanoTime(), i);
			points.add(p);
		}
		return points;
	}

}
